<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-us" xml:lang="en-us">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="DC.Type" content="topic">
  <meta name="DC.Title" content="Backup Fails, and an Error Message Is Displayed Indicating that Percona XtraBackup Does Not Support the INSTANT ADD/DROP COLUMNS Feature">
  <meta name="product" content="">
  <meta name="DC.Relation" scheme="URI" content="en-us_topic_0000002164763106.html">
  <meta name="prodname" content="">
  <meta name="version" content="">
  <meta name="brand" content="">
  <meta name="DC.Publisher" content="20250306">
  <meta name="prodname" content="csbs">
  <meta name="documenttype" content="usermanual">
  <meta name="DC.Format" content="XHTML">
  <meta name="DC.Identifier" content="EN-US_TOPIC_0000002164763150">
  <meta name="DC.Language" content="en-us">
  <link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
  <title>Backup Fails, and an Error Message Is Displayed Indicating that Percona XtraBackup Does Not Support the INSTANT ADD/DROP COLUMNS Feature</title>
 </head>
 <body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px">
  <a name="EN-US_TOPIC_0000002164763150"></a><a name="EN-US_TOPIC_0000002164763150"></a>
  <h1 class="topictitle1">Backup Fails, and an Error Message Is Displayed Indicating that Percona XtraBackup Does Not Support the INSTANT ADD/DROP COLUMNS Feature</h1>
  <div>
   <div class="section">
    <h4 class="sectiontitle">Symptom</h4>
    <p>The database backup job fails to be executed. The error cause shows that Percona XtraBackup does not support the INSTANT ADD/DROP COLUMNS feature.</p>
   </div>
   <div class="section">
    <h4 class="sectiontitle">Possible Causes</h4>
    <p>Percona XtraBackup does not support the INSTANT ADD/DROP COLUMNS feature of MySQL 8.0.29-8.0.31.</p>
   </div>
   <div class="section">
    <h4 class="sectiontitle">Prerequisites</h4>
    <ul>
     <li>Before the optimization, you are advised to back up the related database to prevent data loss caused by exceptions.</li>
     <li>Running a script may lock a table, which affects the ongoing read and write operations. You are advised to perform this operation during off-peak hours or perform batch optimization based on service requirements.</li>
     <li>Optimizing a table may require additional storage space. During the optimization, ensure that the server has sufficient disk space.</li>
    </ul>
   </div>
   <div class="section">
    <h4 class="sectiontitle">Troubleshooting</h4>
    <ol>
     <li><span>Log in to the host where the client is installed as user <strong>root</strong>.</span></li>
     <li><span>Run the following command to create a script file named <strong>optimize_innodb_tables.sh</strong>:</span><p></p><pre class="screen">touch optimize_innodb_tables.sh</pre> <p></p></li>
     <li><span>Run the following command to edit the <strong>optimize_innodb_tables.sh</strong> file:</span><p></p><pre class="screen">vi optimize_innodb_tables.sh</pre> <p></p></li>
     <li><span>Copy and paste the following content to the <strong>optimize_innodb_tables.sh</strong> file:</span><p></p><pre class="screen">#!/bin/bash

# Database configuration
DB_HOST="<em>xxx.x.x.x</em>"               # MySQL host URL, usually the IP address of the local or remote server.
DB_USER="<em>Username</em>"                    # MySQL username
DB_PASS="<em>Password</em>"                     # MySQL password
DB_NAME="<em>mysql</em>"                   #Name of the database to be queried

# Query all InnoDB tables of the versions with unprocessed lines.
result=$(mysql -h $DB_HOST -u $DB_USER -p$DB_PASS $DB_NAME -e \
    'SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE TOTAL_ROW_VERSIONS &gt; 0;' \
    -s --skip-column-names)

# Write the query result to a temporary file.
echo "$result" &gt;&gt; tmp_result.txt

# Delete the lines starting with mysql: (which may be the line of the default database name).
sed -i '/^mysql:/d' tmp_result.txt

# Read each table name in the temporary file line by line.
while IFS= read -r line; do
  if [ -n "$line" ]; then
    # Separate the schema and table names.
    schema=$(echo "$line" | awk -F "/" '{ print $1}') # Extract schema name.
    table=$(echo "$line" | awk -F "/" '{ print $2}') # Extract table name.

    # Construct the OPTIMIZE TABLE statement.
    optimize_table_sql="optimize table \`$schema\`.\`$table\`"

    # Output the executed SQL statement.
    echo "${optimize_table_sql}"

    # Run the OPTIMIZE TABLE statement.
    result=$(mysql -h $DB_HOST -u $DB_USER -p$DB_PASS $DB_NAME -e "${optimize_table_sql}")

# Output the execution result.
    echo "execute result $result"
  fi
done &lt; "tmp_result.txt"

# Delete temporary files.
rm -rf tmp_result.txt</pre> <p></p></li>
     <li><span>Run the following command to run the script file:</span><p></p><pre class="screen">./optimize_innodb_tables.sh</pre> <p>If the following information is displayed in the command output, the backup is successful:</p> <pre class="screen">optimize table `sales_db`.`customers` 
execute result Optimize table `sales_db`.`customers` operation completed
optimize table `sales_db`.`orders` 
execute result Optimize table `sales_db`.`orders` operation completed 
optimize table `sales_db`.`products` 
execute result Optimize table `sales_db`.`products` operation completed</pre> <p></p></li>
    </ol>
   </div>
   <div class="section">
    <h4 class="sectiontitle">Suggestions</h4>
    <p>None.</p>
   </div>
   <div class="section">
    <h4 class="sectiontitle">Reference</h4>
    <p>None.</p>
   </div>
  </div>
  <div>
   <div class="familylinks">
    <div class="parentlink">
     <strong>Parent topic:</strong> <a href="en-us_topic_0000002164763106.html">FAQs</a>
    </div>
   </div>
  </div>
 </body>
</html>